﻿@using PagedList
@using PagedList.Mvc
@model IEnumerable<NapCardOnline.Models.Payment>
@{
    ViewBag.Title = "Lịch sử thanh toán";
}
<h2>@ViewBag.Title</h2>
<fieldset>
    <legend>@ViewBag.Title</legend>
    <div class="tabbable">
        <!-- Only required for left/right tabs -->
        <ul class="nav nav-tabs">
            <li class="active">@Html.ActionLink("Thanh toán", "Index", "Payment")</li>
            <li>@Html.ActionLink("Gửi tiền", "Index", "Recharge")</li>
            <li>@Html.ActionLink("Chuyển tiền", "Index", "TransferFund")</li>
        </ul>
        <div class="tab-pane active" id="tab1">
            <table class="table table-striped table-bordered">
                <thead>
                    <tr>
                        <th>
                            Mã GD
                        </th>
                        <th>
                            Dịch vụ
                        </th>
                        <th>
                            Tài khoản nhận
                        </th>
                        <th>
                            Ngày giờ giao dịch
                        </th>
                        <th>
                            Số tiền
                        </th>
                        <th>
                            Tiền chiết khấu
                        </th>
                        <th>
                            Trạng thái
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>
                                @item.PaymentNo
                            </td>
                            <td>
                                @item.Service.ServiceName
                            </td>
                            <td>
                                @item.PaymentCodeAccount
                            </td>
                            <td>
                                @item.AACreateDate
                            </td>
                            <td style="text-align: right">
                                @string.Format("{0:0,0}", item.PaymentAmount)
                            </td>
                            <td style="text-align: right">
                                @string.Format("{0:0,0}", item.PaymentCommissionAmount)
                            </td>
                            <td>
                                @switch (item.FK_Status)
                                {
                                    case 1:
                                    <span class="label label-success">
                                        @item.Status1.StatusName
                                    </span>
                                   break;
                                    case 2:
                                    <span class="label label-important">
                                        @item.Status1.StatusName
                                    </span>
                                   break;
                                    case 3:
                                    <span class="label label-warning">
                                        @item.Status1.StatusName
                                    </span>
                                   break;
                                }
                            </td>
                        </tr>
                    }
                </tbody>
                <tfoot>
                    <tr>
                        <th colspan="3" style="text-align: center;">
                            Có tất cả @(ViewBag.CountPayment)
                            giao dịch
                        </th>
                        <th style="text-align: center;">
                            Tổng cộng
                        </th>
                        <th style="text-align: right">@ViewBag.TotalAmount
                        </th>
                        <th style="text-align: right">@ViewBag.TotalCommisionAmount
                        </th>
                        <th>
                        </th>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
    @Html.PagedListPager((IPagedList)ViewBag.OnePageOfPayment, page => Url.Action("Index", new { page }))
</fieldset>
